#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll rr() {
    ll s = 0, w = false, c = getchar();
    for (; !isdigit(c); c = getchar())
        w = w || c == '-';
    for (; isdigit(c); c = getchar())
        s = s * 10 + c - '0';
    return w ? -s : s;
}

// END OF HEADER

int main() {
    int n = rr();
    vector<int> s(n), box(n);
    for (int i = 0; i < n; i++)
        s[i] = rr();
    for (int i = 0; i < n; i++)
        box[i] = 100;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int j = 0;
        while (s[i] > box[j])
            j++;
        ans = max(ans, j);
        printf("%d %d\n", s[i], j + 1);
        box[j] -= s[i];
    }
    printf("%d\n", ans + 1);

    return 0;
}
